//
//  Define.swift
//  OfficeExaminationSwift
//
//  Created by Yeeewz on 2018/1/9.
//  Copyright © 2018年 Yeeewz. All rights reserved.
//

import Foundation
//布局
import SnapKit
//网络
import Moya
//json
import SwiftyJSON
//json 转 model
//import ObjectMapper
import UIKit
/*
颜色
 */
func KCOLORWITHRGB(red : CGFloat , green : CGFloat , blue : CGFloat) -> UIColor {
    return UIColor.init(red: red / 255.0, green: green / 255.0, blue: blue / 255.0, alpha: 1.0)
}
let KCOLORWHITE = UIColor.white
//宽高比例
let KHEIGHT = UIScreen.main.bounds.size.height
let KWIDTH = UIScreen.main.bounds.size.width
func KLineY(Y : CGFloat) -> CGFloat {
    //iPhone6
    return Y * KHEIGHT / 667.0
}
func KLineX(X : CGFloat) -> CGFloat{
    //iPhone6
    return X * KWIDTH / 375.0
}
//字体
func KFONT(fontSize : CGFloat) -> UIFont {
    return UIFont.systemFont(ofSize: fontSize)
}
//字典转json
func converDictionaryToJsonString(dic: [String:AnyObject]) -> String{
    let jsonData = try? JSONSerialization.data(withJSONObject: dic, options: JSONSerialization.WritingOptions.prettyPrinted)
    let jsonString =  String(data: jsonData!, encoding: String.Encoding.utf8)
    return jsonString!
}
//字典转json再转字典
func converDictionaryToJsonDic(dic:[String:AnyObject]) -> [String:AnyObject]{
    let jsonData = try? JSONSerialization.data(withJSONObject: dic, options: JSONSerialization.WritingOptions.prettyPrinted)
    let jsonString =  String(data: jsonData!, encoding: String.Encoding.utf8)
    return ["json":jsonString as AnyObject]
}
//MD5
//func MD5STRING(string: String) -> String {
//    let str = string.cString(using: String.Encoding.utf8)
//    let strLen = CUnsignedInt(string.lengthOfBytes(using: String.Encoding.utf8))
//    let digestLen = Int(CC_MD5_DIGEST_LENGTH)
//    
//}






































